/**
 * 获取url上的参数值
 * @param {*} name 参数名
 * @returns
 */
export function getParameter(name: string) {
  const url = decodeURI(location?.href);
  const arr = url.split(name + "=");
  if (!arr.length || arr.length === 1) {
    return "";
  }
  const str2 = arr[1];
  let index = 0;
  if (str2.includes("&")) {
    index = str2.indexOf("&");
  } else if (str2.includes("#")) {
    index = str2.indexOf("#");
  } else {
    index = str2.length;
  }
  const value = str2.substring(0, index);
  return value;
}
